package org.niu.str;

import java.util.*;

public class FindRelativeRanks {
    public String[] findRelativeRanks(int[] score) {
        int[] c = score.clone();
        String[] ans = new String[score.length];
        // 序号-》成绩
        Map<Integer,Integer> mp = new HashMap<>();
        Arrays.sort(score);
        for (int i = score.length-1; i >= 0; i--) {
            mp.put(score[i],score.length-i);
        }
        for (int i = 0; i < c.length; i++) {
            if(mp.get(score[i]) == 1){
                ans[i] = "Gold Medal";
            }
            else if(mp.get(score[i]) == 2){
                ans[i] = "Silver Medal";
            }
            else if(mp.get(score[i]) == 3){
                ans[i] = "Bronze Medal";
            }else{
                ans[i] = String.valueOf(mp.get(i));
            }
        }
        return ans;
    }
}
